package cn.stylefeng.guns.modular.business.frequency.ordertransportrelation.controller;

import cn.stylefeng.guns.core.annotion.BusinessLog;
import cn.stylefeng.guns.core.enums.LogAnnotionOpTypeEnum;
import cn.stylefeng.guns.core.pojo.response.ResponseData;
import cn.stylefeng.guns.core.pojo.response.SuccessResponseData;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import cn.stylefeng.guns.modular.business.frequency.ordertransportrelation.service.OrderTransportRelationService;
import cn.stylefeng.guns.modular.business.frequency.ordertransportrelation.model.param.OrderTransportRelationParam;

import javax.annotation.Resource;

/**
 * tt_order_transport_relation 控制器
 *
 * @author: yujie
 * @date: 2023/05/09 17:16
 */
@RestController
public class OrderTransportRelationController {

    @Resource
    private OrderTransportRelationService orderTransportRelationService;

    /**
     * 分页查询tt_order_transport_relation
     *
     * @author yujie
     * @date 2023/05/09 17:16
     */
    @GetMapping("/orderTransportRelation/page")
    @BusinessLog(title = "tt_order_transport_relation_分页查询", opType = LogAnnotionOpTypeEnum.QUERY)
    public ResponseData page(OrderTransportRelationParam orderTransportRelationParam) {
        return new SuccessResponseData(orderTransportRelationService.page(orderTransportRelationParam));
    }

    /**
     * 获取全部tt_order_transport_relation
     *
     * @author yujie
     * @date 2023/05/09 17:16
     */
    @GetMapping("/orderTransportRelation/list")
    @BusinessLog(title = "tt_order_transport_relation_查询所有", opType = LogAnnotionOpTypeEnum.QUERY)
    public ResponseData list(OrderTransportRelationParam orderTransportRelationParam) {
        return new SuccessResponseData(orderTransportRelationService.list(orderTransportRelationParam));
    }

    /**
     * 查看详情tt_order_transport_relation
     *
     * @author yujie
     * @date 2023/05/09 17:16
     */
    @GetMapping("/orderTransportRelation/detail")
    @BusinessLog(title = "tt_order_transport_relation_查看详情", opType = LogAnnotionOpTypeEnum.DETAIL)
    public ResponseData detail(@Validated(OrderTransportRelationParam.detail.class) OrderTransportRelationParam orderTransportRelationParam) {
        return new SuccessResponseData(orderTransportRelationService.detail(orderTransportRelationParam));
    }

    /**
     * 添加tt_order_transport_relation
     *
     * @author yujie
     * @date 2023/05/09 17:16
     */
    @PostMapping("/orderTransportRelation/add")
    @BusinessLog(title = "tt_order_transport_relation_增加", opType = LogAnnotionOpTypeEnum.ADD)
    public ResponseData add(@RequestBody @Validated(OrderTransportRelationParam.add.class) OrderTransportRelationParam orderTransportRelationParam) {
        orderTransportRelationService.add(orderTransportRelationParam);
        return new SuccessResponseData();
    }

    /**
     * 删除tt_order_transport_relation
     *
     * @author yujie
     * @date 2023/05/09 17:16
     */
    @PostMapping("/orderTransportRelation/delete")
    @BusinessLog(title = "tt_order_transport_relation_删除", opType = LogAnnotionOpTypeEnum.DELETE)
    public ResponseData delete(@RequestBody @Validated(OrderTransportRelationParam.delete.class) OrderTransportRelationParam orderTransportRelationParam) {
        orderTransportRelationService.delete(orderTransportRelationParam);
        return new SuccessResponseData();
    }

    /**
     * 编辑tt_order_transport_relation
     *
     * @author yujie
     * @date 2023/05/09 17:16
     */
    @PostMapping("/orderTransportRelation/edit")
    @BusinessLog(title = "tt_order_transport_relation_编辑", opType = LogAnnotionOpTypeEnum.EDIT)
    public ResponseData edit(@RequestBody @Validated(OrderTransportRelationParam.edit.class) OrderTransportRelationParam orderTransportRelationParam) {
        orderTransportRelationService.edit(orderTransportRelationParam);
        return new SuccessResponseData();
    }


}
